/**
 * 文件读取
 */

const fs = require('fs-extra')

exports.readFile = (path) => {
	let result = ""
	try {
		result = fs.readFileSync(path, 'utf8')
	}
	catch (err) {
		// console.log(err)
	}
	return result
}

exports.writeFile = (path, txt) => {
	try {
		fs.writeFileSync(path, txt)
	}
	catch (err) {
		console.log(err)
	}
}


exports.readJson = (path) => {
	let result = ""
	try {
		result = fs.readJsonSync(path)
	}
	catch (err) {
		// console.log(err)
	}
	return result
}

exports.writeJson = (path, data) => {
	try {
		fs.writeJsonSync(path, data)
	}
	catch (err) {
		console.log(err)
	}
}